Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

277
Vistas
Microsoft azure "text to speech" javascript, onend event

Good day.

I'm making a website, integrating the microsoft text-to-speech API. And I need to activate a function when the audio finishes playing it.

I've been doing a lot of research but I didn't find any method that really works.

Some "onend" event that works.

Do you know how I could achieve this? Thank you

    startSpeakTextAsyncButton.addEventListener("click", function () {
          startSpeakTextAsyncButton.disabled = true;
          resultDiv.innerHTML = "";
          
          synthesizer = new SpeechSDK.SpeechSynthesizer(speechConfig);
  
          synthesizer.speakTextAsync(
            phraseDiv.value,
            function (result) { 
              startSpeakTextAsyncButton.disabled = false;
              resultDiv.innerHTML = "synthesis in process";
              if (result.reason === SpeechSDK.ResultReason.SynthesizingAudioCompleted) {
                resultDiv.innerHTML = "synthesis finished";
              } else if (result.reason === SpeechSDK.ResultReason.Canceled) {
                resultDiv.innerHTML = "synthesis failed. Error detail: " + result.errorDetails + "\n";
              }
              
              synthesizer.close();
              synthesizer = undefined;
            },
            function (err) { 
              startSpeakTextAsyncButton.disabled = false;
              resultDiv.innerHTML = "Error: ";
              resultDiv.innerHTML = err;
              resultDiv.innerHTML = "\n";
              window.console.log(err);
  
              synthesizer.close();
              synthesizer = undefined;
          });

        });
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda